﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MyWpfControls.Pages
{
    /// <summary>
    /// DataGrids.xaml 的交互逻辑
    /// </summary>
    public partial class DataGrids : Page
    {
        public class User
        {
            public String name { get; set; }
            public Int32 age { get; set; }
            public Boolean sex { get; set; }
            public DateTime create_time { get; set; }
        }

        public DataGrids()
        {
            InitializeComponent();
        }

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            List<User> user_list = new List<User>() {
                new User(){
                    name = "名字1",
                    age = 17,
                    sex = true,
                    create_time = DateTime.Now
                },
                new User()
                {
                    name = "名字2",
                    age = 21,
                    sex = false,
                    create_time = DateTime.Now.AddMinutes(-10)
                },
                new User()
                {
                    name = "名字2",
                    age = 21,
                    sex = false,
                    create_time = DateTime.Now.AddMinutes(-10)
                },
                new User()
                {
                    name = "名字2",
                    age = 21,
                    sex = false,
                    create_time = DateTime.Now.AddMinutes(-10)
                },
                new User()
                {
                    name = "名字2",
                    age = 21,
                    sex = false,
                    create_time = DateTime.Now.AddMinutes(-10)
                },
                new User()
                {
                    name = "名字2",
                    age = 21,
                    sex = false,
                    create_time = DateTime.Now.AddMinutes(-10)
                },
                new User()
                {
                    name = "名字2",
                    age = 21,
                    sex = false,
                    create_time = DateTime.Now.AddMinutes(-10)
                },
                new User()
                {
                    name = "名字2",
                    age = 21,
                    sex = false,
                    create_time = DateTime.Now.AddMinutes(-10)
                }
            };

            this.dg0.ItemsSource = user_list;
            this.dg.ItemsSource = user_list;
            this.dg2.ItemsSource = user_list;
        }
    }
}
